PTRSER page# 0001 next
2: COMMENT ⊗   VALID 00005 PAGES
3: C REC  PAGE   DESCRIPTION
4: C00001 00001
5: C00002 00002    BEGIN PTRSER ↔ SUBTTL PTRSER    PAPER TAPE READER SERVICE, J. SAUTER, 11-NOV-68
6: C00003 00003    UUO DISPATCH TABLE:
7: C00009 00004    PAPER TAPE READER INTERRUPT.
8: C00013 00005    P1 CLOCK LEVEL AND HUNG TIMEOUT CODE
9: C00019 ENDMK
10: C⊗;
    PTRSER page# 0002 next  prev
12: BEGIN PTRSERSUBTTL PTRSER    PAPER TAPE READER SERVICE, J. SAUTER, 11-NOV-68
13: 
14: ;PTR CONTROL REGISTER
15: POWER←←400              ;POWER ON ON PDP-6, NOT EOT ON PDP-10.
16: BINARY←←40              ;BINARY MODE.
17: BUSY←←20                ;PTR IS BUSY READING A WORD.
18: DONE←←10                ;PTR HAS A WORD.
19: 
20: ;SPECIAL ASCII CHARACTERS:
21: NULL←←200               ;NULL CHARACTER
22: RUBOUT←←377             ;RUBOUT.
23: 
24: ;SPECIAL BITS IN LH OF IOS:
25: PTRPOW←←200000          ;PTR HAS (HAD) POWER ON.
26: PTRNPW←←100000          ;PTR DOESN'T HAVE POWER ON FOR FIRST OPERATION.
27: STOPTR←←40000           ;HUNG TIMEOUT ASSUMES EOF.
    PTRSER page# 0003 next  prev
29: ;UUO DISPATCH TABLE:
30:         JRST    PTRINI          ;INITIALIZE.
31:         JRST    PTRHNG          ;HUNG  TIMEOUT.
32: PTRDSP:
33:         JRST    PTRXRL          ;RELEASE.
34:         POPJ    P,              ;CLOSE.
35:         JRST    ILLOUT          ;OUTPUT
36: 
37: ;INPUT UUO
38: PTRINP: PSYNC   PTRCSC
39:         PUSHJ   P,SETACT        ;SET IOACT.
40:         TLNN    IOS,IOBEG       ;FIRST TIME?
41:         JRST    @PTRIN1         ;NO.
42:         TLO     IOS,IOFST       ;YES.  SET UP THINGS.
43:         TLZ     IOS,PTRPOW
44:         PUSHJ   P,SETBYT        ;SET UP TAC.
45:         MOVEM   TAC,PTRPTR      ;SAVE FOR INTERRUPT ROUTINES.
46: PTRIN5: TLZN    IOS,PTRNPW      ;HAS THE LOSER FLAG BEEN SEEN ALREADY?
47:         JRST    @PTRIN1         ;TO PTRP1U FOR 1 PROCESSOR, OR PTRP2U FOR TWO.
48: ;HERE ON SECOND INPUT AFTER FIRST INPUT DISCOVERED POWER OFF ON THE PDP-6 READER
49:         PUSHJ   P,CLRACT        ;CLEAR IO ACTIVE
50:         XSYNC   PTRCSC          ;RELEASE SYNCHRONIZER.
51:         PUSHJ   P,HNGSTP        ;PRINT DEVICE PTR OK? AND STOP JOB.
52:         JRST    PTRINP
53: 
54: PTRP2U: PUSHJ   P,STOIOS        ;STORE IOS.
55:         SETOM   PTRACT          ;REQUEST P2 TO START READER.
56:         JRST    XPOPJ           ;DESYNCHRONIZE AND EXIT
57: 
58: ;HERE AT P2 CLOCK LEVEL
59: PTRP2: MOVE    TAC,PTRACT      ;P2 START REQUEST?
60:         JUMPE   TAC,CPOPJ       ;NO.
61:         PSYNC   PTRCSC          ;SYNCHRONIZE.
62:         SETZM   PTRACT          ;INDICATE REQUEST GRANTED.
63:         MOVEI   DDB,PTRDDB      ;SET UP DDB AND IOS.
64:         MOVE    IOS,DEVIOS(DDB)
65:         TLZE    IOS,STOPTR      ;
66:         JRST    PTRYRL          ;HUNG TIMEOUT REQUESTS THAT THE READER STOP.
67: PTRP1U:
68: PTRIN2: TLZN    IOS,IOBEG               ;FIRST TIME?
69:         JRST    PTRIN3                  ;NO.
70:         CONSZ   PTR,POWER               ;YES.  POWER ON?
71:         TLOA    IOS,PTRPOW              ;YES.
72:         JUMPN   PID,PTRIN4              ;POWER OFF ON PDP-6 READER.
73:         SKIPA   TAC1,[PTRCHN!BUSY]      ;SET TAC1 WITH CONO START
74: PTRIN3: MOVEI   TAC1,PTRCHN!DONE        ;SET TAC1 WITH CONO CONTINUE
75:         PUSHJ   P,STOIOS                ;STORE IOS, RESET HUNG COUNT.
76:         LDB     TAC,PIOMOD              ;GET MODE.
77:         CAIE    TAC,IB                  ;IMAGE BINARY?
78:         CAIN    TAC,B                   ;OR BINARY?
79:         TRO     TAC1,BINARY             ;YES.  SET READER INTO BINARY MODE.
80:         MOVEM   TAC1,PTRSTR             ;REMEMBER FOR INTERRUPT LEVEL.
81:         MOVEI   TAC,DONE                ;WAIT FOR DONE FLAG.
82:         CONO    PI,PTROFF
83:         SETZM   PTRDSC                  ;SET NOT PTR DISCONNECTING.
84:         HRRM    TAC,@PTRCON             ;SET UP BITS.
85:         CONSO   PTR,7                   ;SKIP IF READER IS RUNNING!
86:         CONO    PTR,@PTRSTR             ;READER IDLE.  KICK IT.
87:         CONO    PI,PTRON
88:         CONSZ   PTR,POWER               ;WE SHOULD SEE POWER OR TAPE BY NOW.
89:         JRST    XPOPJ                   ;DESYNCRONIZE AND RETURN.
90: PTRIN4: TLO     IOS,PTRNPW!IOBEG        ;FLAG NO POWER AVAILABLE
91:         TLZN    IOS,STOPTR
92:         SETOM   PTRADV                  ;FLAG THE PDP-10
93:         PUSHJ   P,STOIOS                ;STORE IOS
94:         JUMPN   PID,XPOPJ
95:         JRST    PTRIN5                  ;HANG ON THE PDP-10
96: 
97: PTRINI: SYNINI  PTRCSC          ;INITIALIZE SYNCHRONIZER CELLS.
98: ;DETERMINE WHICH PROCESSOR TO USE.  IF ONE PROCESSOR IS A
99: ;PDP-6, USE IT.  IF P2 DOES NOT EXIST, USE P1, OTHERWISE,
100: ;USE P2.
101:         MOVEI   AC1,PTRP1U      ;ASSUME P1
102:         MOVEI   AC2,PTRCN1
103:         HRRZ    TAC,P2NUM       ;GET NUMBER OF P2 (=6 OR =10)
104:         CAIN    TAC,6           ;IS IT A PDP-6?
105:         JRST    USEP2           ;YES. USE IT.
106:         JUMPE   TAC,USEP1       ;IF THERE IS NO P2, USE P1.
107:         HRRZ    TAC,P1NUM       ;GET NUMBER OF P1.
108:         CAIN    TAC,6           ;IS IT A PDP-6?
109:         JRST    USEP1           ;YES. USE IT.
110: USEP2:  MOVEI   AC1,PTRP2U
111:         MOVEI   AC2,PTRCN2
112: USEP1:  MOVEM   AC1,PTRIN1      ;SET DISPATCH FOR INPUT UUO'S
113:         MOVEM   AC2,PTRCON      ;SET ADDRESS FOR CONSZ BITS.
114:         HLLZS   PTRCN1
115:         HLLZS   PTRCN2
116: 
117: PTRXRL: SETZM   PTRDDB+DEVIOS   ;CLEAR READER STATUS.  RELEASE UUO.
118: PTRREL:                        ;ALSO CALLED FROM SYSINI
119:         CONO    PTR,0           ;STOP READER, DISCONNECT IT FROM PI
120:         HLLZS   @PTRCON
121:         POPJ    P,
122: 
123: PTRYRL: PUSHJ   P,IOSET
124:         JRST    PWROFF          ;SIMULATE POWER OFF.
    PTRSER page# 0004 next  prev
126: ;PAPER TAPE READER INTERRUPT.
127: PTRINT:
128:         SKIPL   PTRDSC          ;SKIP DATAI IF WE ARE DISCONNECTING.
129:         DATAI   PTR,PTRCHR      ;READ CHAR FROM READER.
130:         JSR     @PTRSAV         ;SAVE ACCUMULATORS.
131:         PSYNC   PTRCSC
132:         MOVEI   DDB,PTRDDB      ;SET UP REGISTERS
133:         PUSHJ   P,IOSET
134:         MOVE    IOS,DEVIOS(DDB)
135:         CONSO   PTR,POWER       ;POWER ON?
136:         JRST    PWROFF          ;NO.
137:         TLON    IOS,PTRPOW      ;POWER IS ON NOW, WAS IT BEFORE?
138:         JRST    PTRXIT          ;POWER IS ON FOR THE FIRST TIME.
139:         SKIPE   PTRDSC          ;IS PTR BEING DISCONNECTED?
140:         JRST    PTRDIS          ;YES. DO IT.
141:         MOVE    DAT,PTRCHR      ;GET CHARACTER.
142: PTRIN0: TRNE    IOS,B           ;BINARY MODE?
143:         JRST    PTRI0           ;YES. (MODES 10,13,14)
144:         IORI    DAT,200         ;IGNORE PARITY.
145:         CAIE    DAT,NULL        ;NULL CHARACTER?
146:         CAIN    DAT,RUBOUT      ;OR RUBOUT?
147:         JRST    PTRXIT          ;YES.  IGNORE CHAR AND START READING NEXT.
148: PTRI0:  PUSHJ   P,STODAT        ;STORE DATA IN BUFFER.
149:         JFCL                    ;CHECKSUM ERROR.
150:         JRST    PTRI1           ;BLOCK COMPLETE.
151:         MOVEM   ITEM,DEVCTR(DDB);INCOMPLETE.  STORE ITEM.
152: PTRXIT:
153: PTRXT1: PUSHJ   P,STOIOS        ; STORE IOS, RESET HUNG COUNT
154: XPOPJ:  XSYNC   PTRCSC
155:         POPJ    P,              ;DISMISS INTERRUPT.
156: 
157: ;MORE I-LEVEL ROUTINES.
158: PWROFF: TLZ     IOS,PTRPOW      ;NOTE THAT READER IS OFF.
159:         TLO     IOS,IOEND+IOBEG
160:         PUSHJ   P,PTRREL        ;SHUT IT OFF!
161:         LDB     TAC,PIOMOD      ;GET MODE.
162:         CAIE    TAC,B           ;CHECKSUM-BINARY?
163:         JRST    PTREI           ;NO.
164:         TLNN    IOS,IOFST       ;INCOMPLETE BLOCK?
165:         TRO     IOS,IOIMPM      ;YES. COMPLAIN.
166:         PUSHJ   P,CLRACT        ;CLEAR I/O ACTIVE BIT.
167:         JRST    PTRI1A          
168: 
169: ;BLOCK INCOMPLETE
170: PTREI:  PUSHJ   P,STOSQD        ;TRUNCATE BUFFER, STORE W.C.
171:         JFCL                    ;FALL INTO PTRI1
172: ;BLOCK COMPLETE.
173: PTRI1:  MOVEM   ITEM,DEVCTR(DDB);STORE ITEM COUNT.
174: PTRI1A: JUMPE   PID,PTRI2       ;NO. ONE PROCESSOR
175:         SETOM   PTRDSC          ;MUST DISCONNECT PTR
176:         TLZN    IOS,STOPTR
177:         SETOM   PTRADV          ;REQUEST BUFFER ADVANCE.
178:         JRST    PTRXT1          ;RELEASE CONTROL OF IOS AND DISMISS
179: 
180: PTRI2:  TLO     IOS,IOFST       ;(SINGLE PROCESSOR)
181:         TLZE    IOS,IOW         ;UNWAIT THE JOB.
182:         PUSHJ   P,SETIOD        ;IF NEEDED.
183:         TLNE    IOS,PTRPOW      ;POWER OFF?
184:         PUSHJ   P,ADVBFF        ;NOT POWER OFF, ADVANCE BUFFERS
185:         JRST    PTRI3           ;NO MORE BUFFER SPACE.
186:         JRST    PTRXIT          ;START READER, STORE IOS, AND  DISMISS INTERRUPT.
187: 
188: PTRI3:  PUSHJ   P,CLRACT        ;NO BUFFER SPACE. CLEAR IOACT.
189:         SETOM   PTRDSC          ;REQUST PTR DISCONNECT.
190:         JRST    PTRXT1          ;RELEASE SYNCHRONIZER. DISMISS INTERRUPT.
191: 
192: PTRDIS: JUMPN   PID,PTRDS1
193:         SKIPG   @PTRADR         ;BUFFER FREE?
194:         JRST    PTRDS1          ;NO. MUST DISCONNECT.
195:         DATAI   PTR,DAT
196:         JRST    PTRIN0          ;INPUT CHARACTER AND PROCESS AS NORMAL.
197: 
198: PTRDS1: PUSHJ   P,PTRREL        ;STOP PTR.
199:         JRST    PTRXT1          ;DISMISS INTERRUPT
    PTRSER page# 0005 next  prev
201: ;P1 CLOCK LEVEL AND HUNG TIMEOUT CODE
202: 
203: PTRHNG: MOVE    TAC,PTRIN1
204:         CAIN    TAC,PTRP1U
205:         POPJ    P,                      ;ON PDP-10 I DON'T UNDERSTAND HANGS.
206:         PSYNC   PTRCSC                  ;SYNCHRONIZE.
207:         MOVE    IOS,PTRDDB+DEVIOS       ;GET IOS
208:         TLZN    IOS,PTRPOW              ;HAVE WE SEEN POWER ON?
209:         JRST    XPOPJ                   ;NO. LET IT HANG.
210:         TLON    IOS,STOPTR!IOEND        ;MAKE PTR STOP. PRETEND END OF TAPE.
211:         AOS     (P)                     ;SET SKIP RETURN TO AVOID HUNG PTR MESSAGE
212:         MOVEM   IOS,PTRDDB+DEVIOS       ;STORE IOS
213:         SETOM   PTRACT                  ;KICK PDP-6
214:         JRST    XPOPJ                   ;RELEASE SYNCHRONIZER AND WAIT FOR PDP-6.
215: 
216: 
217: ;HERE AT P1 CLOCK LEVEL
218: PTRP1: SETZM   PTRADV          ;CLEAR REQUEST
219:         PSYNC   PTRCSC
220:         MOVEI   DDB,PTRDDB      ;LOAD UP REGISTERS.
221:         MOVE    IOS,DEVIOS(DDB)
222:         TLNE    IOS,PTRNPW
223:         TRO     IOS,IOIMPM      ;READING WITHOUT READER ON.
224:         TLO     IOS,IOFST       ;NEXT ITEM WILL BE FIRST OF A BUFFER.
225:         TLZE    IOS,IOW         ;IS JOB WAITING FOR PTR?
226:         PUSHJ   P,SETIOD        ;YES.  UNWAIT IT.
227:         LDB     J,PJOBN         ;SET J
228:         MOVE    PROG,JBTADR(J)  ;
229:         PUSHJ   P,ADVBFF        ;ADVANCE BUFFERS.
230:         JRST    PTRP1A          ;OUT OF BUFFER SPACE.
231:         TLNE    IOS,IOEND!PTRNPW ;END OF FILE OR ERROR?
232:         JRST    PTRP1A          ;YES. STOP READER.
233:         PUSHJ   P,STOIOS        ;STORE IOS.
234:         SETOM   PTRACT          ;ACTIVATE PTR.
235:         JRST    XPOPJ           ;RELEASE SYNCHRONIZER AND RETURN
236: 
237: PTRP1A: PUSHJ   P,CLRACT        ;CLEAR IOACTIVE, DON'T RESTART THE READER
238:         JRST    XPOPJ
239: 
240:         BEND    PTRSER
 EOF: PTRSER end-of-file. cnt=4